package com.dream.app;

import java.util.*;

public class BiColorSphere {

    public static void main(String[] args) {
        List<Map<String, List<Integer>>> num = getNumber(10);
        for (Map<String, List<Integer>> stringListMap : num) {
            System.out.println(stringListMap);
        }
    }
    public static List<Map<String, List<Integer>>> getNumber(int n){
        List<Map<String, List<Integer>>> list = new ArrayList<>();
        for (int i=0;i<n;i++){
            Map<String, List<Integer>> map = new HashMap<>();
            map.put("red", getRed());
            ArrayList<Integer> list1 = new ArrayList<>();
            list1.add(getBlue());
            map.put("blue", list1);
            list.add(map);
        }
        return list;
    }
    public static List<Integer> getRed() {
        List<Integer> list = new ArrayList<>();
        for (int i = 1; 7 > i; i++) {
            Integer red = getRedNum();
            getRedList(list, red);
        }
        Collections.sort(list);
        return list;
    }
    public static Integer getRedNum(){
        int min = 1;
        int max = 33;
        Random r = new Random();
        return r.nextInt((max - min) + 1) + min;
    }
    public static List<Integer> getRedList(List<Integer> list,Integer n){
        if(!list.contains(n)){
            list.add(n);
        }else {
            getRedList(list,getRedNum());
        }
        return list;
    }
    public static Integer getBlue() {
        int min = 1;
        int max = 16;
        Random r = new Random();
        return r.nextInt((max - min) + 1) + min;
    }
}
